/*
 * @Descripttion: 基础过滤器,用于扩展
 * @version: 1.0.0
 * @Author: lfzxs@qq.com
 * @Date: 2023-05-10 14:11:08
 * @LastEditors: lfzxs@qq.com
 * @LastEditTime: 2023-05-11 15:14:06
 */
package middleware



type(
	NotifyMap map[string]any

	// 通知函数
	NotifyFun = func(sender any,msg NotifyMap)


	BaseMiddleware struct {
		notifys []NotifyFun
	}
)

func AddNotify(bm *BaseMiddleware,fun NotifyFun){
	bm.notifys = append(bm.notifys,fun)
}

func (bm *BaseMiddleware) SendNotify(sender any,msg NotifyMap){
	for _, notify := range bm.notifys {
		go notify(sender,msg)
	}
}